<?php

/**
 * This is the model class for table "xman_outside_project".
 *
 * The followings are the available columns in table 'xman_outside_project':
 * @property integer $outside_project_id
 * @property integer $user_id
 * @property string $outside_project_name
 * @property integer $outside_project_language_id
 * @property integer $outside_project_excution_time
 * @property string $outside_project_user_position
 * @property string $outside_project_assigment_description
 * @property integer $outside_project_size
 *
 * The followings are the available model relations:
 * @property ProgrammingLanguage $outsideProjectLanguage
 * @property User $user
 */
class OutsideProject extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return OutsideProject the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'xman_outside_project';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('user_id, outside_project_name, outside_project_language_id, outside_project_excution_time, outside_project_user_position, outside_project_assigment_description, outside_project_size', 'required'),
			array('user_id, outside_project_language_id, outside_project_excution_time, outside_project_size', 'numerical', 'integerOnly'=>true),
			array('outside_project_name, outside_project_user_position', 'length', 'max'=>100),
			array('outside_project_assigment_description', 'length', 'max'=>500),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('outside_project_id, user_id, outside_project_name, outside_project_language_id, outside_project_excution_time, outside_project_user_position, outside_project_assigment_description, outside_project_size', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'outsideProjectLanguage' => array(self::BELONGS_TO, 'ProgrammingLanguage', 'outside_project_language_id'),
			'user' => array(self::BELONGS_TO, 'User', 'user_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'outside_project_id' => 'Outside Project',
			'user_id' => 'User',
			'outside_project_name' => 'Outside Project Name',
			'outside_project_language_id' => 'Outside Project Language',
			'outside_project_excution_time' => 'Outside Project Excution Time',
			'outside_project_user_position' => 'Outside Project User Position',
			'outside_project_assigment_description' => 'Outside Project Assigment Description',
			'outside_project_size' => 'Outside Project Size',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('outside_project_id',$this->outside_project_id);
		$criteria->compare('user_id',$this->user_id);
		$criteria->compare('outside_project_name',$this->outside_project_name,true);
		$criteria->compare('outside_project_language_id',$this->outside_project_language_id);
		$criteria->compare('outside_project_excution_time',$this->outside_project_excution_time);
		$criteria->compare('outside_project_user_position',$this->outside_project_user_position,true);
		$criteria->compare('outside_project_assigment_description',$this->outside_project_assigment_description,true);
		$criteria->compare('outside_project_size',$this->outside_project_size);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
public function  getPositionList(){
		return array(
		'Leader'=>'Leader',
		'Coder'=>'Coder',
		'Designer'=>'Designer',
		'Tester'=>'Tester',
		);
	}
}